from drg_group.yinchuan_2023.Base import message,intersect,SS_VALID
from drg_group.yinchuan_2023.DRG import MDCL_DRG

def group(record):
  adrg_zd=["C64.x00x001","C66.x00","C67.900","C79.102","D41.201","E11.201+N08.3*","N03.900","N10.x02","N12.x02","N13.000","N13.100x001","N13.201","N13.202","N13.203","N13.301","N13.400","N13.501","N13.503","N13.504","N13.600","N13.601","N13.602","N13.603","N13.605","N13.701","N13.801","N17.900","N18.300","N18.902","N20.000","N20.000x001","N20.100","N20.200x001","N21.000","N21.100","N23.x00","N28.805","N28.821","N28.826","N28.828","N28.829","N28.833","N28.834","N30.000","N30.809","N39.000","Q62.103","Q62.104","Q62.200","T83.002","T83.101","T83.102","T83.500x002","Z46.600x001","Z46.602"]
  adrg_zd1=[]
  adrg_ss=["56.0x00x002","56.0x00x003","56.0x00x004","56.0x00x005","56.0x00x006","56.0x00x007","56.0x00x008","56.0x00x011","56.0x00x012","56.0x00x013","56.0x00x014","56.0x00x015","56.0x02","56.0x03","56.0x04","56.0x05","56.0x06","56.0x07","56.0x08","56.2x00x007","56.2x01","56.2x04","56.2x05","56.4100","56.4100x012","56.4101","56.4104","56.4105","56.4106","56.4107","56.4200","56.4201","56.6100x004","56.7400","56.7402","56.8901","56.9100","56.9900","59.0201","59.8x00x004","59.8x00x005","59.8x00x006","59.8x00x007","59.8x01","59.8x03","59.8x04","59.8x05","59.9900x002","59.9901"]
  adrg_ss1=[]
  adrg_ss2=[]
  dept_list=[]
  if True and record.zdList[0] in adrg_zd and record.ssList and record.ssList[0] in adrg_ss and record.ssList and intersect(record.ssList,adrg_ss):
    message('符合LC1入组条件，匹配规则：主诊断匹配、主手术匹配、某一手术匹配')
    
    if MDCL_DRG.LC19_group(record):
      return 'LC19'

    return 'LC1'
  else:
    return ''

